<?php
namespace Admin\Controller;
use Think\Controller;

//用户表
class UserCouponController extends CommonController{
	public function index(){
		$this->rel=M("user_coupon a")
		->join('left join agency_user_list d on a.user_id=d.user_id')
		->field("a.*,d.name")
		->select();
		$this->display();
	}
	public function edit(){
		$Id=I("get.id");
		$data['state']=1;
		if(M("user_coupon")->where(array("pack_id"=>$Id))->save($data)){
			$this->success("恢复成功","index",1);
		}else{
			$this->error("恢复失败","",1);
		}
	}
	public function del(){
		$Id=I("get.id");
		$data['state']=0;
		if(M("user_coupon")->where(array("pack_id"=>$Id))->save($data)){
			$this->success("删除成功","index",1);
		}else{
			$this->error("删除失败","",1);
		}
	}
}